﻿using System;

namespace AutoMockingContainer
{
    public class FullNameCreator
    {
        private readonly IFirstNameProvider _firstNameProvider;
        private readonly IMiddleNameProvider _middleNameProvider;
        private readonly ILastNameProvider _lastNameProvider;
        private readonly ILogger _logger;

        public FullNameCreator(IFirstNameProvider firstNameProvider, IMiddleNameProvider middleNameProvider, ILastNameProvider lastNameProvider, ILogger logger)
        {
            _firstNameProvider = firstNameProvider;
            _middleNameProvider = middleNameProvider;
            _lastNameProvider = lastNameProvider;
            _logger = logger;
        }

        public string Calculate()
        {
            _logger.Log("Getting the first name");
            var firstName = _firstNameProvider.GetFirstName();
            _logger.Log("Getting the middle name");
            var middleName = _middleNameProvider.GetMiddleName();
            _logger.Log("Getting the last name");
            var lastName = _lastNameProvider.GetLastName();
            return String.Format("{0} {1} {2}", firstName, middleName, lastName);
        }
    }
}